package pl.task;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class OpenHelper extends SQLiteOpenHelper
{
    private static final String DATABASE_NAME = "task.db";
    private static final int DATABASE_VERSION = 1;

    public OpenHelper(Context context)
    {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db)
    {
        TaskEntityHelper.createTable(db);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
    {
        Log.w("task", "Upgrading database, this will drop tables and recreate.");
        TaskEntityHelper.dropTable(db);

        onCreate(db);
    }
}
